__author__ = 'shawhen'

from PyQt5.QtGui import *

from . import label_status_images_rc


def set_error(status_label_widget, err_tip):
    status_label_widget.clear()
    status_label_widget.setStyleSheet("""QLabel {
                background: url(:/uranome_label_status_images/images/error.png);
                background-position: center left;
                background-repeat: no-repeat;
                padding-left: 16px;
            }""")
    status_label_widget.setText(err_tip)
    status_label_widget.setVisible(True)


def set_wait(status_label_widget):
    status_label_widget.clear()
    status_label_widget.setStyleSheet("""QLabel {
                background: url();
                background-repeat: no-repeat;
            }""")
    run_movie = QMovie(":/uranome_label_status_images/images/wait_small.gif")
    status_label_widget.setMovie(run_movie)
    status_label_widget.setVisible(True)
    run_movie.start()

def set_ok(status_label_widget):
    status_label_widget.clear()
    status_label_widget.setStyleSheet("""QLabel {
                background: url(:/uranome_label_status_images/images/ok.png);
                background-position: center left;
                background-repeat: no-repeat;
                padding-left: 16px;
            }""")
    status_label_widget.setVisible(True)